#ifndef INC_BOARD
#define INC_BOARD

#include "position.h"
#include "node.h"
//#include "patternNode.h"
/*#include <stack>
#include "../../goBase/players/databd.h"*/

class BoardPosition: public Position {

private:

	int _group;
		
public:

	void setGroup(int gId) {_group = gId;}
	int getGroupNumber(){return _group;}
};

class Board {

public:

    Board(int);
	Board(Board*);
	Board(Board&);
    ~Board();
	Board operator=(Board&);
	bool isEmpty(int, int);
	bool isBlack(int, int);
	bool boardIsEmpty();
	void setEmpty(int, int);
	void setBlack(int, int);
	void setWhite(int, int);
	void setAlive(int, int, bool);
	int getSize();
	Position getPosition(int i, int j);
	void displayBoard();
	void playGame();
	void playGame(bool UCTColor);
	bool launchMonteCarlo(bool lastPlayedColor, int prevX, int prevY, int prevCaptX, int prevCaptY);
	void initLabel();
	void setLabel();
	void recurLabel(int posx, int posy);
	void setChainAlive (int label);
	void checkIfAlive ();
	void checkIfAliveTemp();
	int capture();
	void capture(int &captX, int &captY);
	bool suicideCheck (int posx, int posy, bool isBlack);
	void initAlive();
	bool checkIfEye(int posx, int posy);
	bool validMove(bool color);
	NodeList validMoveList(bool color, int prevX, int prevY, int prevCaptX, int prevCaptY);
	bool areaScoring();
	bool simpleKo(int posx, int posy, bool isBlack, int prevPosx, int prevPosy, int prevCaptX, int prevCaptY);
	
private:

	BoardPosition ** _theBoard;
    int _size;
};


#endif